home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Techy Stuff / Doco ƒ / CSMP ƒ / CSMP-V1-060.TXT < prev    next >
Encoding:
Text File  |  1992-06-03  |  47.3 KB  |  1,144 lines

  1. C.S.M.P. Digest             Mon, 27 Apr 92       Volume 1 : Issue 60
  2.  
  3. Today's Topics:
  4.  
  5.     Help...Free-text DB for Mac (w. 4D ??)?
  6.     Apple Event Manager & Threads & Futures Questions :-)
  7.     Mac Programming
  8.     INIT idea
  9.     Summary of Think Pascal and MPW Object Pascal comparison
  10.     Serial source code
  11.     Looping Asynch Sound
  12.     C++ exception handling (was: Zortech C++ Summary)
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. These digests are available (by using FTP, account anonymous, your email
  18. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  19. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  20. Questions list.  The last several issues of the digest are available from
  21. sumex-aim.stanford.edu as well.
  22.  
  23. These digests are also available via email.  Just send a note saying that you
  24. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  25. automatically receive each new digest as it is created.
  26.  
  27. The articles in these digests are taken directly from comp.sys.mac.programmer.
  28. They are not edited; all articles included in this digest are in their original
  29. posted form.  The only articles that are -not- included in these digests are
  30. those which didn't receive any replies (except those that give information
  31. rather than ask a question).  All replies to each article are concatenated
  32. onto the original article in the order in which they were received.  Article
  33. threads are not added to the digests until the last article added to the
  34. thread is at least one month old (this is to ensure that the thread is dead
  35. before adding it to the digests).
  36.  
  37. Send administrative mail to mkelly@cs.uoregon.edu.
  38.  
  39. -------------------------------------------------------
  40.  
  41. From: rjacks@austlcm.sps.mot.com (rodney jacks/vlk9)
  42. Subject: Help...Free-text DB for Mac (w. 4D ??)?
  43. Date: 23 Mar 92 22:11:21 GMT
  44. Organization: Motorola Inc, Austin, Texas
  45.  
  46. >From: t20410@hkkk.fi (Jyri Kuivalainen)
  47. >Subject: Help... free-text DB for Mac (w. 4D ??) ?
  48. >I am going to build a free-text database application with 4th
  49. >Dimension in Mac-environment. The structure of the database will be
  50. >close to the structure of encyclopedia: I have 1-3 indexed keywords
  51. >and then variable-length text field (in 4th D. text field can contain
  52. >max 36k characters, that is quite short).  In database seaches text
  53. >portion will be heavily used. Database will be rather large, larger
  54. >than 4D databases normally.
  55.  
  56. >Question: Is it reasonable to desing it this way? Are there any ways
  57. >to speed up the seaches, I am afraid that a text search will not be
  58. >fast enough? Am I banging my head against the wall? Is there some
  59. >other way (tool) to build this? (I am very happy with pointers,
  60. >commercials and ads).
  61.                         
  62. You might do some background research into Bloom filters.  They
  63. have been used in several free-text searching systems.  Essentially
  64. they provide a cheap efficient (ie. insanely low memory requirement) 
  65. way of narrowing your search by creating signatures of the text records.
  66. Then you search the signatures when looking for a keyword. If a
  67. match occurs then you search the database looking at the appropriate
  68. records/files pointed to by the signature.
  69.  
  70. If you are going to include a database engine in your application
  71. you may have trouble tying the two together, but if your going to
  72. build from scratch then definitely check them out.  If you would
  73. like more info about them such as literature references send me a 
  74. message.
  75.  
  76. - -Rodney
  77. ***********************************************************************
  78. **  Rodney Jacks                                                     **
  79. **  Motorola Inc, Austin, Texas                                      **
  80. **  E-mail:  rjacks@austlcm.sps.mot.com                              **
  81. **  Picard asks Worf what he thought of commanding the _Enterprise_  **
  82. **  "Comfortable chair."     ST.TNG _The Emissary_                   ** 
  83. ***********************************************************************
  84.  
  85. ---------------------------
  86.  
  87. From: gwatts@cdf34.fnal.gov (Gordon Watts -- U of Rochester)
  88. Subject: Apple Event Manager & Threads & Futures Questions :-)
  89. Date: 20 Mar 92 15:32:43 GMT
  90. Organization: Fermilab
  91.  
  92. Hi all,
  93.   I've been doing some research into Apple's unsupported Threads and Futures
  94. package (see develop #6 and #7).  In the process of trying to understand how
  95. the thing worked, I came up with a number of questions :-).  Ok, a lot of
  96. questions.  9 of them.  They cover topics on the AE Manager, Futures, and then
  97. the AE Manager again.
  98.  
  99. 1). Does the Apple Event Manager always store replys in the reply ae you give
  100. it in the AESend call?
  101.  
  102.     In inside mac vol 6, 6-64, they talk about an AESend with a timeout.
  103.     If the server does not respond, AESend returns.  However, if the
  104.     apple event comes in *after* this, it will still be put into the
  105.     AppleEvent that was passed to AESend.  An error errReplyNotReady
  106.     (or some such error message) will be returned if you try to access
  107.     this reply before the reply has arrived at your application.
  108.  
  109.     The docs seem to reply this only happens when you specify a time-out
  110.     value to AESend.  If I request the reply event to be queued, is it
  111.     still stored in the AppleEvent I gave as the reply parameter to
  112.     AESend?
  113.  
  114.     Is this one of the basic mechanisms that the threads package uses
  115.     to implement futures?
  116.  
  117. 2). What if I trash my reply apple event descriptor before the apple event
  118.     returns?
  119.  
  120.     Lets say I send an apple event, with a timeout.  I've allocated both
  121.     the apple event and the reply apple event on the stack.  I do an
  122.     AESend, it times out, and I error out of the routine where these
  123.     two apple event data structures were allocated.  I forgot to
  124.     AEDisposeDesc them :-(.  Could this cause a subtle crash later in
  125.     the program if the server does infact return a reply apple event
  126.     later?  [Lets say I call another subroutine that uses the same stack
  127.     space as the reply parameter -- so anything written there would
  128.     override this routines local vars].
  129.  
  130.     Or does the apple event manager just use handles (in the apple
  131.     event descriptor) so the stack is never touched?  It would mean that
  132.     I had some extra memory that would never get deallocated, I suppose.
  133.  
  134.     What if I do a AEDisposeDesc function?  What happens when the reply
  135.     comes in?  Does the AEM realize that I've disposed of the reply
  136.     AppleEvent, and not save the data, or have I created a unreferenced
  137.     handle?
  138.  
  139. 3). Can I AEDisposeDesc a future?
  140.  
  141.     Do I block while trying to dispose of a future?  I hope not :-).  Is the
  142.     dispose clean?  Will it release all the memory?
  143.  
  144. 4). With futures, how do I get the AEResetTimer notifications?
  145.  
  146.     Lets say I do an apple event via the Ask function.  I block when I
  147.     try to access the reply parameter.  I have a dream function installed
  148.     for my thread -- to watch for a timeout.  What if the server app
  149.     does a AEResetTimer call for this apple event?  How can I see that
  150.     I should reset my dream proc timer?
  151.  
  152. 5).  Is there any way to access the other parameters of the AESend routine when
  153. using futures?
  154.  
  155.     I want to specify a queueing property, or a user interaction level
  156.     and still want my reply to be a future.  Is there any way to do it?
  157.     The Ask function only accpets an apple event, none of the other
  158.     parameters.
  159.  
  160. 6).  Back to straight apple events.  Is there a way to check if my reply
  161. has arrived yet?
  162.  
  163.     Lets say I send, with a timeout value of 0 ticks.  I then want to 
  164.     know if my reply apple event has been gotten.  Is there a general
  165.     way to do this?  Do I just have to access some random attribute and
  166.     see if the error return is errReplyNotReady?
  167.  
  168. 7).  How can I get the default reply event deep in my program.
  169.  
  170.     I see the AEGetTheCurrentEvent will return the apple event currently
  171. being processed.  Is there any way to get the default reply event in a similar
  172. manner?
  173.  
  174. 8).  Is there any way to add something to the default apple event?
  175.  
  176.     If I would like the reply apple event to contain some tag, can I, as
  177. the sender, modify the default reply apple event?  I notice the futures package
  178. has some way of knowing when a future apple event reply comes in -- does it
  179. remember transaction ids (or reply id), or does it add some tag to the reply
  180. apple event?  I think the AEM calls some hook into the futures package.  Is
  181. this a special handler (see next question)?
  182.  
  183. 9).  What are special handlers?
  184.  
  185.     There is a special handler table -- written up at the very end of the
  186. apple event chapter.  Two selectors are defined: keyPreDispatch and
  187. keySelectProc.  Nothing is said about the routines you can define for them. 
  188. What are they?  What do they do, etc. etc.
  189.  
  190. Wow -- lots of questions.  Thanks for all your time!
  191.  
  192.     Gordon.
  193.  
  194. +++++++++++++++++++++++++++
  195.  
  196. From: greggor@Apple.COM (Greg L. Anderson)
  197. Date: 24 Mar 92 02:15:36 GMT
  198. Organization: Apple Computer Inc., Cupertino, CA
  199.  
  200. In article <+B+I+5!XZ@linac.fnal.gov> gwatts@cdf34.fnal.gov writes:
  201. >Hi all,
  202. >  I've been doing some research into Apple's unsupported Threads and Futures
  203. >package (see develop #6 and #7).  In the process of trying to understand how
  204. >the thing worked, I came up with a number of questions :-).  Ok, a lot of
  205. >questions.  9 of them.  They cover topics on the AE Manager, Futures, and then
  206. >the AE Manager again.
  207. >
  208. >1). Does the Apple Event Manager always store replys in the reply ae you give
  209. >it in the AESend call?
  210. >
  211. >    In inside mac vol 6, 6-64, they talk about an AESend with a timeout.
  212. >    If the server does not respond, AESend returns.  However, if the
  213. >    apple event comes in *after* this, it will still be put into the
  214. >    AppleEvent that was passed to AESend.  An error errReplyNotReady
  215. >    (or some such error message) will be returned if you try to access
  216. >    this reply before the reply has arrived at your application.
  217. >
  218. >    The docs seem to reply this only happens when you specify a time-out
  219. >    value to AESend.  If I request the reply event to be queued, is it
  220. >    still stored in the AppleEvent I gave as the reply parameter to
  221. >    AESend?
  222. >
  223. >    Is this one of the basic mechanisms that the threads package uses
  224. >    to implement futures?
  225. >
  226. >2). What if I trash my reply apple event descriptor before the apple event
  227. >    returns?
  228. >
  229. >    Lets say I send an apple event, with a timeout.  I've allocated both
  230. >    the apple event and the reply apple event on the stack.  I do an
  231. >    AESend, it times out, and I error out of the routine where these
  232. >    two apple event data structures were allocated.  I forgot to
  233. >    AEDisposeDesc them :-(.  Could this cause a subtle crash later in
  234. >    the program if the server does infact return a reply apple event
  235. >    later?  [Lets say I call another subroutine that uses the same stack
  236. >    space as the reply parameter -- so anything written there would
  237. >    override this routines local vars].
  238. >
  239. >    Or does the apple event manager just use handles (in the apple
  240. >    event descriptor) so the stack is never touched?  It would mean that
  241. >    I had some extra memory that would never get deallocated, I suppose.
  242. >
  243. >    What if I do a AEDisposeDesc function?  What happens when the reply
  244. >    comes in?  Does the AEM realize that I've disposed of the reply
  245. >    AppleEvent, and not save the data, or have I created a unreferenced
  246. >    handle?
  247. >
  248. >3). Can I AEDisposeDesc a future?
  249. >
  250. >    Do I block while trying to dispose of a future?  I hope not :-).  Is the
  251. >    dispose clean?  Will it release all the memory?
  252. >
  253. >4). With futures, how do I get the AEResetTimer notifications?
  254. >
  255. >    Lets say I do an apple event via the Ask function.  I block when I
  256. >    try to access the reply parameter.  I have a dream function installed
  257. >    for my thread -- to watch for a timeout.  What if the server app
  258. >    does a AEResetTimer call for this apple event?  How can I see that
  259. >    I should reset my dream proc timer?
  260. >
  261. >5).  Is there any way to access the other parameters of the AESend routine when
  262. >using futures?
  263. >
  264. >    I want to specify a queueing property, or a user interaction level
  265. >    and still want my reply to be a future.  Is there any way to do it?
  266. >    The Ask function only accpets an apple event, none of the other
  267. >    parameters.
  268. >
  269. >6).  Back to straight apple events.  Is there a way to check if my reply
  270. >has arrived yet?
  271. >
  272. >    Lets say I send, with a timeout value of 0 ticks.  I then want to 
  273. >    know if my reply apple event has been gotten.  Is there a general
  274. >    way to do this?  Do I just have to access some random attribute and
  275. >    see if the error return is errReplyNotReady?
  276. >
  277. >7).  How can I get the default reply event deep in my program.
  278. >
  279. >    I see the AEGetTheCurrentEvent will return the apple event currently
  280. >being processed.  Is there any way to get the default reply event in a similar
  281. >manner?
  282. >
  283. >8).  Is there any way to add something to the default apple event?
  284. >
  285. >    If I would like the reply apple event to contain some tag, can I, as
  286. >the sender, modify the default reply apple event?  I notice the futures package
  287. >has some way of knowing when a future apple event reply comes in -- does it
  288. >remember transaction ids (or reply id), or does it add some tag to the reply
  289. >apple event?  I think the AEM calls some hook into the futures package.  Is
  290. >this a special handler (see next question)?
  291. >
  292. >9).  What are special handlers?
  293. >
  294. >    There is a special handler table -- written up at the very end of the
  295. >apple event chapter.  Two selectors are defined: keyPreDispatch and
  296. >keySelectProc.  Nothing is said about the routines you can define for them. 
  297. >What are they?  What do they do, etc. etc.
  298. >
  299. >Wow -- lots of questions.  Thanks for all your time!
  300. >
  301. >    Gordon.
  302.  
  303.  
  304. - -- 
  305. =====================   ===========================   =====================
  306. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  307. Macintosh Bodhisattva   Macintosh System Software      O O  is  ideal  O O
  308. greggor@apple.com       Finder Team                     O     shape     O
  309. =====================   ===========================   =====================
  310.  
  311. +++++++++++++++++++++++++++
  312.  
  313. From: greggor@Apple.COM (Greg L. Anderson)
  314. Date: 24 Mar 92 18:39:58 GMT
  315. Organization: Apple Computer Inc., Cupertino, CA
  316.  
  317. In article <64223@apple.Apple.COM> greggor@Apple.COM (Greg L. Anderson) writes:
  318. [Useless waste of bandwidth deleted]
  319.  
  320. I replied to this message yesterday, but my news server decided to post
  321. the unedited file instead of the version that contained my answers.  Sorry
  322. for the wasted bandwidth; let's try it again:
  323.  
  324.  
  325. In article <+B+I+5!XZ@linac.fnal.gov> gwatts@cdf34.fnal.gov writes:
  326. >  I've been doing some research into Apple's unsupported Threads and Futures
  327. >package (see develop #6 and #7).
  328.  
  329. I worked on the Threads & Futures package with Mike Gough, so I'll try
  330. to answer your questions.
  331.  
  332. >1). Does the Apple Event Manager always store replys in the reply ae you give
  333. >it in the AESend call?
  334. [discussion deleted]
  335.  
  336. The AppleEvent manager copies the AppleEvent that you provide into a
  337. heap object; you will not crash if you 'orphan' your stack-based AppleEvent
  338. before the reply comes back.
  339.  
  340. This works because the AppleEvent contains a descriptor type (long word)
  341. and a data handle (a pointer to a pointer to the actual data).  The AppleEvent
  342. manager changes the data handle using its copy of the pointer to it.
  343. Of course, you'll have a memory leak if you orphan the reply (since you
  344. are supposed to dispose of it), but you don't have to worry about keeping
  345. it on the stack all the time.  This is very important in the Threads package,
  346. where the stack might not always be in the same place that it was when
  347. the AppleEvent (future) was sent.
  348.  
  349. >    Is this one of the basic mechanisms that the threads package uses
  350. >    to implement futures?
  351.  
  352. Yes, it is.  Additional (undocumented) support for futures was rolled
  353. into the AppleEvent manager before it shipped.
  354.  
  355. >2). What if I trash my reply apple event descriptor before the apple event
  356. >    returns?
  357.  
  358. If you called AEDisposeDesc you would be in trouble, but otherwise your
  359. only problem would be with memory leaks (see answer to 1, above).
  360.  
  361. >3). Can I AEDisposeDesc a future?
  362.  
  363. No, you don't block if you dispose a future.  You should use the
  364. DisposeFuture call rather than calling AEDisposeDesc directly.  I think
  365. that the only consiquence of not doing so is a memory leak, but
  366. offhand I'm not sure.  If you dispose of a future that has threads
  367. blocked on it, all of the threads die (via EndThread).  If you call
  368. AEDisposeDesc directly, they stay blocked (and you're likely to have
  369. a memory leak).
  370.  
  371. >4). With futures, how do I get the AEResetTimer notifications?
  372. >
  373. >    Lets say I do an apple event via the Ask function.  I block when I
  374. >    try to access the reply parameter.  I have a dream function installed
  375. >    for my thread -- to watch for a timeout.  What if the server app
  376. >    does a AEResetTimer call for this apple event?  How can I see that
  377. >    I should reset my dream proc timer?
  378.  
  379. AEResetTimer doesn't work with futures.  This function extends the time
  380. that a synchronous AESend will wait for a reply.  Futures return from
  381. AESend immediately, though (since they are send with a timeout of zero--
  382. kAEImmediateTimeout), so resetting the timer does not have any effect.
  383.  
  384. Read the section on dreaming in Develop #7 for the preferred method for
  385. handling timeouts with Futures.
  386.  
  387. >5).  Is there any way to access the other parameters of the AESend routine when
  388. >using futures?
  389.  
  390. You cannot specify a queueing property for a future.  Futures implicitly
  391. use wait reply with kImmediateTimeout.  Anything else isn't a future.
  392.  
  393. It's bad that you can't specify a user interaction level, though, and
  394. unfortunately you cannot just call AESend to make a future (more on this
  395. in #6).
  396.  
  397. It's a bug.  I should fix it.
  398.  
  399. >6).  Back to straight apple events.  Is there a way to check if my reply
  400. >has arrived yet?
  401.  
  402. If you send an AppleEvent in waitReply mode with any timeout value
  403. (kImmediateTimeout is a good one, though), it will become a future
  404. as soon as it times out.  This is important, because if you are using
  405. the Futures package, accessing joe random property of the reply will
  406. cause the future to block--but since the reply wasn't created with
  407. the "ask" function, your future will not be correctly initialized.
  408. Bad buju.
  409.  
  410. Looking at the code, it appears that nothing will happen, but you
  411. probably won't get back the correct error result (which should be
  412. errReplyNotReady).
  413.  
  414. This also looks like a bug that I should fix.  It looks like the error
  415. returned will probably be kAEDescNotFound, but I haven't tried this myself.
  416.  
  417. >7).  How can I get the default reply event deep in my program.
  418. >
  419. >    I see the AEGetTheCurrentEvent will return the apple event currently
  420. >being processed.  Is there any way to get the default reply event in a similar
  421. >manner?
  422.  
  423. I don't know why you want to do this.  I've never used AEGetTheCurrentEvent
  424. because I've never needed it--just use futures and pass the reply to any
  425. function that needs it.
  426.  
  427. >8).  Is there any way to add something to the default apple event?
  428.  
  429. Short answer:  no.  There really isn't any such thing as a 'default'
  430. AppleEvent.
  431.  
  432. >    If I would like the reply apple event to contain some tag, can I, as
  433. >the sender, modify the default reply apple event?  I notice the futures package
  434. >has some way of knowing when a future apple event reply comes in -- does it
  435. >remember transaction ids (or reply id), or does it add some tag to the reply
  436. >apple event?  I think the AEM calls some hook into the futures package.  Is
  437. >this a special handler (see next question)?
  438.  
  439. When a reply comes in, the AppleEvent manager overwrites all information
  440. in the AppleEvent that you supply with the contents of the reply.  The
  441. exception to this is the "refCon" attribute of the AppleEvent, which isn't
  442. really stored in the main AppleEvent structure anyway.  If an AppleEvent
  443. you send has a refCon attribute, it's copied to the reply automatically.
  444. There is no way for you to add information to the reply directly.
  445.  
  446. The futures package uses the refCon attribute, so your code will break if
  447. you try to change the refCon of a future.
  448.  
  449. >9).  What are special handlers?
  450.  
  451. Special hanlders are handlers that are called in special circumstances.  :>
  452.  
  453. >    There is a special handler table -- written up at the very end of the
  454. >apple event chapter.  Two selectors are defined: keyPreDispatch and
  455. >keySelectProc.  Nothing is said about the routines you can define for them. 
  456. >What are they?  What do they do, etc. etc.
  457.  
  458. The PreDispatch handler is called for all AppleEvents before the event
  459. is dispatched to its appropriate dispatch table.  However, system
  460. pre-dispatch handlers are __only__ called if the event will not be handled
  461. by any Application handler.  Application pre-dispatch handlers are
  462. called even if a 'regular' handler will get the AppleEvent.
  463.  
  464. I don't know what a keySelectProc handler is for.
  465.  
  466. - -- 
  467. =====================   ===========================   =====================
  468. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  469. Macintosh Bodhisattva   Macintosh System Software      O O  is  ideal  O O
  470. greggor@apple.com       Finder Team                     O     shape     O
  471. =====================   ===========================   =====================
  472.  
  473. ---------------------------
  474.  
  475. From: Bryan.Socha@f921.n273.z1.ieee.org (Bryan Socha)
  476. Subject: Mac Programming
  477. Date: 17 Mar 92 19:07:01 GMT
  478. Organization: FidoNet node 1:273/921 - Unseen Realit, Philadelphia PA
  479.  
  480. I'm trying to get a basic skeleton program for use with system 7 and Think C
  481. (or mpw)..  I seem to keep hitting bugs that I cannot understand (since I used
  482. to be a ibm programmer and they're not bugs and I don't have time to relearn c
  483. on mac).  I need something to allow easy adds into apple events for such
  484. things as appletalk and program linking...
  485.  
  486.                                                Bryan 
  487.  
  488. - --  
  489. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  490.  Bryan Socha - Internet: Bryan.Socha@f921.n273.z1.ieee.org
  491.  
  492. +++++++++++++++++++++++++++
  493.  
  494. From: west@turing.toronto.edu (Tom West)
  495. Date: 23 Mar 92 23:23:23 GMT
  496. Organization: CSRI, University of Toronto
  497.  
  498.  
  499.   Here's a general Mac programming question.
  500.  
  501.   I have a program that draws lots of lines and text.  It needs to draw
  502. it to a window that will usually be the maximum possible size and 
  503. uncovered by any other windows.  Of course, it's always possible that
  504. such might not be the case.  The user needs to be able to
  505. see what's going on as the program draws, rather than just the end result.
  506.  
  507.   What I need to know is what is the best generic algorithm for doing this.
  508. (I can't record the lines/text being drawn because it could be of any size.
  509. The user could leave the program going on all night, for example.)
  510. Here are some of the possibilities I see.
  511.  
  512. (1) Draw to a full size off-screen bitmap.  After every line, do a copy
  513.     of the off-screen bitmap to the window with CopyBits.  Try to get the
  514.     alignment right, etc. 
  515.  
  516.     This is our present solution.  The only problem is that it's dead slow.
  517.  
  518. (2) Draw to a full size off-screen bitmap and draw to the window.
  519.  
  520.     Is this any faster?  The draw to the off-screen bitmap is okay because there
  521.     never any clipping or anything, but would drawing the object to the
  522.     window be faster than (1)?
  523.  
  524. (3) Draw to a full size off-screen bitmap and have a VBL task do the
  525.     update from bitmap to screen every 15th of a second or so.
  526.  
  527.     This is complicated, (I haven't used VBL tasks before).  Is it worth
  528.     it?
  529.  
  530.         Thanks in advance for any suggestions.
  531. - -- 
  532.  
  533.     Tom West        
  534.  
  535.    west@turing.toronto.edu  or            "Into The Dark Lands"
  536. tomwest@gpu.utcs.utoronto.ca  or          -Michelle Sagara
  537.        west@hsa.on.ca
  538.  
  539. +++++++++++++++++++++++++++
  540.  
  541. Organization: Penn State University
  542. Date: Tuesday, 24 Mar 1992 08:12:28 EST
  543. From: Christopher Tate <CXT105@psuvm.psu.edu>
  544.  
  545. In article <1992Mar23.182322.692@jarvis.csri.toronto.edu>,
  546. west@turing.toronto.edu (Tom West) says:
  547. >
  548. >(1) Draw to a full size off-screen bitmap.  After every line, do a copy
  549. >    of the off-screen bitmap to the window with CopyBits.  Try to get the
  550. >    alignment right, etc.
  551. >
  552. >    This is our present solution.  The only problem is that it's dead slow.
  553.  
  554. Right.  Having to do a CopyBits every time the image changes is icky.
  555.  
  556. >(2) Draw to a full size off-screen bitmap and draw to the window.
  557. >
  558. >    Is this any faster?  The draw to the off-screen bitmap is okay because    e
  559. >ther
  560. >    never any clipping or anything, but would drawing the object to the
  561. >    window be faster than (1)?
  562.  
  563. Absolutely.  Drawing the line (or whatever) twice, once offscreen and
  564. once on-screen, is almost certainly faster than drawing it once and using
  565. CopyBits on the whole window.
  566.  
  567. >(3) Draw to a full size off-screen bitmap and have a VBL task do the
  568. >    update from bitmap to screen every 15th of a second or so.
  569.  
  570. IMHO, it's not worth it.
  571.  
  572. Personally, I recommend using the offscreen bitmap for window refreshing
  573. ONLY, and draw directly in the window whenever possible.  CopyBits is
  574. fast for what it does, but it does an awful lot that you really aren't
  575. worried about when you're drawing your objects.
  576.  
  577. I would go with (2):  each time you draw an object, draw it both to the
  578. window and to the offscreen image.  If you ever have to update a region
  579. of the window (as in response to other windows moving on top of yours, or
  580. suchlike), use CopyBits to refresh the window's contents to match the
  581. offscreen duplicate.
  582.  
  583. - -------
  584. Christopher Tate     | Cryptogram #21:
  585. cxt105@psuvm.psu.edu |
  586. CXT105@PSUVM.BITNET  |  V MSD'B HQ HJCIQ.  V YBVRR XSPQ YCUQ MXQMIY RQTB.
  587. - ---------------------|
  588. Send me the answer!  |
  589.  
  590. +++++++++++++++++++++++++++
  591.  
  592. From: d88-jwa@iswed.nada.kth.se (Jon W{tte)
  593. Date: 25 Mar 92 12:34:50 GMT
  594. Organization: Royal Institute of Technology, Stockholm, Sweden
  595.  
  596. .csri.toronto.edu> west@turing.toronto.edu (Tom West) writes:
  597.  
  598.    (1) Draw to a full size off-screen bitmap.  After every line, do a copy
  599.        of the off-screen bitmap to the window with CopyBits.  Try to get the
  600.        alignment right, etc. 
  601.  
  602. Slow because you copy a lot of data.
  603.  
  604.    (2) Draw to a full size off-screen bitmap and draw to the window.
  605.  
  606.        Is this any faster?  The draw to the off-screen bitmap is okay because
  607.        there never any clipping or anything, but would drawing the object to
  608.        the window be faster than (1)?
  609.  
  610. If the object is just a line, polygon etc, its OK.
  611. If you have a complicated object, copybits is faster.
  612.  
  613.    (3) Draw to a full size off-screen bitmap and have a VBL task do the
  614.        update from bitmap to screen every 15th of a second or so.
  615.  
  616. VBL tasks may not call CopyBits, since CopyBits may move
  617. memory. Instead, use the standard event loop and post an update
  618. event every 15 seconds.
  619.  
  620. - -- 
  621. h+@nada.kth.se; Jon W{tte, the Diplomat - NOT!
  622.  
  623. ---------------------------
  624.  
  625. Subject: INIT idea
  626. From: speranza@cs.unibo.it (Sauro Speranza)
  627. Date: 23 Mar 92 10:12:21 +0100
  628. Organization: Laboratory for Computer Science, University of Bologna, Italy
  629.  
  630. I've an idea for an INIT: it should patch the QuickDraw
  631. initialization so that it believes the screen is 512x342
  632. pixels, with 64 bytes per row, monochromatic, and install
  633. a VBL which copies this pseudo-video RAM to the real video
  634. RAM; or maybe create a "virtual" second screen with those
  635. characteristics, anyway connected to the CRT through the
  636. VBL.
  637. I believe that with such an INIT many applications (mainly
  638. games) which do not run in Mac IIs should succeed to run,
  639. and since IIs are faster than a Plus or SE they should
  640. run at a reasonable speed. But absolutely I haven't the
  641. know-how to write it: is anybody willing to implement this
  642. idea ?
  643.  
  644. - -- 
  645. Sauro Speranza    e-mail: speranza@cirfid.unibo.it
  646.             speranza@cs.unibo.it
  647. Student in:
  648. Computer Science, Bologna University
  649.  
  650. Mail address:
  651.                   Sauro Speranza , via Cappuccini 18
  652.                   40026 Imola   Italy
  653.                   Tel  +39 542 45666
  654.                        (dall' Italia) 0542/45666
  655. - --
  656.  
  657. +++++++++++++++++++++++++++
  658.  
  659. From: mauser@intercon.com (Richard Chandler)
  660. Date: 23 Mar 92 18:36:27 GMT
  661. Organization: InterCon Systems Corporation
  662.  
  663. In article <1992Mar23.101221.161@cine88.cineca.it>, speranza@cs.unibo.it 
  664. (Sauro Speranza) writes:
  665. > I've an idea for an INIT: it should patch the QuickDraw
  666. > initialization so that it believes the screen is 512x342
  667. > pixels, with 64 bytes per row, monochromatic, and install
  668. > a VBL which copies this pseudo-video RAM to the real video
  669. > RAM; or maybe create a "virtual" second screen with those
  670. > characteristics, anyway connected to the CRT through the
  671. > VBL.
  672. > I believe that with such an INIT many applications (mainly
  673. > games) which do not run in Mac IIs should succeed to run,
  674. > and since IIs are faster than a Plus or SE they should
  675. > run at a reasonable speed. But absolutely I haven't the
  676. > know-how to write it: is anybody willing to implement this
  677. > idea ?
  678.  
  679. It's already been done.  There's a Cdev floating around out there called 
  680. MiniScreen that will let you set the screen size to any arbitrary size and a 
  681. number of pre-defined ones.
  682.  
  683. - --
  684. People are more violently opposed to fur than leather, because it's safer to
  685. harass rich women than biker gangs.
  686. "Ride a motorcycle.  Save Gas, Oil, Rubber, Steel, Aluminum, Parking Spaces,
  687.  The Environment, and Money.  Plus, you get to wear all the leather you want!"
  688.  Rich Chandler, DoD #296
  689.  
  690. ---------------------------
  691.  
  692. From: vrm@hawksnest.cerc.wvu.wvnet.edu (Vasile R. Montan)
  693. Subject: Summary of Think Pascal and MPW Object Pascal comparison
  694. Date: 23 Mar 92 16:15:59 GMT
  695. Organization: Concurrent Engineering Research Center
  696.  
  697. Below is the summary of the email I received in response to a request
  698. for a comparison of Think Pascal and MPW Object Pascal.  Thanks again
  699. to Ingemar, Peter Lau, Casgrain, Tommy and Peter Chang for taking the
  700. time to respond.
  701.  
  702. - -----------------------------------------------------------------------------
  703. From: ingemar@isy.liu.se (Ingemar Ragnemalm)
  704.  
  705. Think Pascal is easy to use and good for projects with one or few people
  706. involved. I have used it on 1 meg plusses with comfort. (Havn't tried that
  707. for the recent versions, though.) It is possible to run it on a floppy-
  708. based system (as if anyone used that nowadays) and a 20-meg disk is more
  709. than enough.
  710.  
  711. MPW is slower, bigger, harder to use, takes lots of space at least on
  712. disk. However, it can be customized, extended and reconfigured in a way
  713. that Think Pascal can't.
  714.  
  715. For both systems, a few extra megs of both RAM and disk is nice, but they
  716. can be used on very small systems. I use Think Pascal on a SE 2/40 at home,
  717. and that's no problem. (System 6.) With System 7, I'd recommend 4 megs.
  718. No special hardware requirement, but MPW is a bit too slow on a Plus/Classic.
  719.  
  720. When comparing comfort, Think Pascal is a clear winner (as long as you
  721. can stand auto-formatting of the code). It is fast and easy to develop
  722. with it. The only real problem you may have is to learn what a "project"
  723. file is - but it is much easier than Makefiles anyway.
  724.  
  725. MPW is for "power users". Definitely unsuited for casual users. It is
  726. puzzling how something this "un-Mac-like" can be Apple's official platform.
  727. No point-and-click, remember commands instead of recognition... I don't
  728. like it at all.
  729.  
  730. So, if he will use it for his own personal projects, he needs Think Pascal.
  731.  
  732. - -----------------------------------------------------------------------------
  733. From: pl4262@csc.albany.edu (Peter Lau)
  734.  
  735. I have never used MPW Ojbect Pascal but I use MPW C and I do use
  736. THINK Pascal and THINK C also.
  737.  
  738. MPW stuff is more expensive (~$300 vs. ~$170)
  739.  
  740. MPW is more unix-like (which is more confusing)
  741. THINK is more Mac-like (which is loaded with other good stuffs)
  742.  
  743. MPW stuffs require at least 4MB and at least a 030 machine.
  744. THINK requires 1-2 MB on any machine. (well, the faster the better, right?)
  745.  
  746. MPW is the official tool in Apple.
  747. THINK is third-party vendor with a lot of happy users.  :-)
  748.  
  749. - -----------------------------------------------------------------------------
  750. From: casgrain@ERE.UMontreal.CA (Casgrain Philippe)
  751.  
  752.     Think Pascal (v4.0) is a fast and easy-to-use compiler. It is fairly
  753. cheap (in terms of $$$) and can interface with the THINK Class library,
  754. which contains a whole bunch ;) of useful routines. If you want quick
  755. turnaround for your applications (i.e. minimal time from when you think of
  756. the concepts to when it actually works), it's great.
  757.  
  758.     I personnally use MPW Pascal (v3.2, _not_ 4.0), and I love it, but
  759. it costs many more $$$. Its main strenghts are in multi-developer projects.
  760. But what I like the most about it is the MPW Shell, a powerful, unix-like
  761. "editor": it does text in any way you want, and you can build a tool to do
  762. what it does not.  Also, there is a scripting mechanism, which can allow
  763. you to automate almost any task you do on the mac (I use it for backups).
  764.     The MPW environment also supports various compilers (I have a 
  765. FORTRAN compiler to link old (1970) math routines in my Pascal programs).
  766.  
  767. - -----------------------------------------------------------------------------
  768. From: f85-tno@nada.kth.se (Tommy Nordgren)
  769.  
  770. I would strongly recommed your friend to chose Think Pascal.
  771. 1. According to news I've read, Think pascal compiles much faster than MPW.
  772. 2. Think is bundled with an application reading MPW pascal source code, and
  773.    convert it to a form that can be used in Think Pascal. This will allow 
  774.    using source from both environments.
  775. 3. Think Pascal automatically maintains a file bescribing the dependencies
  776.    between source file. This file is called a Project.
  777. 4. Think Pascal contains an integrated debugging environment, with a graphic
  778.    user interface. 
  779.    The environment consists of following :
  780.    When you are running under the environment, and stops at an error or
  781.    breakpoint, a small hand icon points to the statement in the window
  782.    containing the file (if is is open) or to the file name in the project 
  783.    window(if it is closed).
  784.    A window called Observe. Here you can enter expressions,to be evaluated 
  785.     when a break occurs.
  786.    A window called Lightsbug. Here you can inspect variables anywhere in the
  787.    procedure call chain, inspect Heap Zones, inspect CPU registers,inspect
  788.    inspect bytes at any memory adress. It is also possible to edit values.
  789.    In the lightbug window you can also register varibles so that the debugger
  790.    will be reentered each time one of them is changed.
  791.     A window called instant -here you can enter pascal statements, to be
  792.    executed at once.
  793. 5. Think Pascal in bundled with a main program file to use for debugging desk
  794.     accesories. 
  795. 6. Think Pascal is bundles with a class library for managing the graphic user
  796.    interface. The Think Class Library require less memory , and probably are 
  797.    much easier to learn than MacApp from Apple.
  798. 7. Think Pascal stores libraries, in a format compatible with MPW libraries,
  799.    and can read all Libraries Made under the MPW assembler. Some foreign 
  800.     libraries might be unusuable, because they contain references to the
  801.    MPW runtime libraries.
  802. I cant tell you much about MPW, except that the MPW environment uses a
  803. COMMANDLINE Interface.
  804. I am Currently using Think Pascal 3.0 so I cant tell what new features are
  805. available under 4.0.
  806. I would strongly recommend your friend to chose think Pascal.
  807.  
  808. - -----------------------------------------------------------------------------
  809. From: calvin@leland.Stanford.EDU (Peter)
  810.  
  811.     Here at Stanford the introductory CS classes are taught using
  812. Think Pascal. The environment is really slick. It has a very nice
  813. built-in debugger that lets you set stops, examine memory, and break
  814. when conditions occur. It runs well on almost every macintosh model,
  815. by this I mean that it runs slowly on an SE, but not unbearably so.
  816. It also comes with think's object library, and a MacApp that has been
  817. slightly modified. All in all it is a good environment.
  818.  
  819.     The only thing I know about MPW Pascal is that the compiler
  820. is slow, and you still have to write makefiles and stuff. Think 
  821. takes care of all of this for you with its project structure.
  822.  
  823. ---------------------------
  824.  
  825. From: jhp@wpi.WPI.EDU (John Petrangleo)
  826. Subject: Serial source code
  827. Organization: Worcester Polytechnic Institute
  828. Date: Mon, 23 Mar 1992 17:08:05 GMT
  829.  
  830. I am looking for some sample code to use the sserial ports
  831. in my programs.  I am using Think C 5.0 and System 7.
  832.  
  833. What I need is:
  834.     1)  opening the port (either one)
  835.     2)  sending bytes
  836.     3)  recieving bytes
  837.     4)  closing the port
  838.  
  839. I don't need elegant code, I just need to see how it is done.
  840. Thanks
  841.  
  842. - ---------------
  843. jhp@wpi.wpi.edu
  844. - ---------------
  845.  
  846. +++++++++++++++++++++++++++
  847.  
  848. From: glenn@gla-aux.uucp (Glenn Austin)
  849. Date: Wed, 25 Mar 92 01:13:22 PST
  850. Organization: The Pit Lane
  851.  
  852.  
  853. In article <1992Mar23.170805.20455@wpi.WPI.EDU> (comp.sys.mac.programmer), jhp@wpi.WPI.EDU (John Petrangleo) writes:
  854. > I am looking for some sample code to use the sserial ports
  855. > in my programs.  I am using Think C 5.0 and System 7.
  856. > What I need is:
  857. >     1)  opening the port (either one)
  858. >     2)  sending bytes
  859. >     3)  recieving bytes
  860. >     4)  closing the port
  861. > I don't need elegant code, I just need to see how it is done.
  862.  
  863. How's this for simple (yes -- this is simplified C for the Pascal programmers
  864. out there):
  865.  
  866. - ---
  867. short        toolID;
  868. ConnHandle    hconn;
  869. CMBufferSizes    bufSiz;
  870.  
  871. (void) InitCRM();
  872. (void) InitCTBUtilities();
  873. if (InitCM())
  874.     return();
  875.  
  876. toolID = CMGetProcID("\pSerial Tool");
  877. if (toolID == -1)
  878.     return();        // serial tool wasn't found!
  879.  
  880. {
  881.     short    i;
  882.  
  883.     for (i = cmDataIn; i <= cmRsrvOut; ++i)
  884.         bufSiz[i] = 0;
  885. }
  886.  
  887. hconn = CMNew(toolID, cmData, bufSiz, 0, 0);
  888. if (hconn == nil)
  889.     return();        // failed to create conn record
  890.  
  891.                 // configure the port...
  892. if (CMSetConfig(hconn, "Baud 9600 dataBits 8 Parity None Port \"Modem Port\""))
  893. {
  894.     CMDispose(hconn);
  895.     return();
  896. }
  897.                 // or -- you could use CMChoose to let the
  898.                 // user configure the tool they way they
  899.                 // need it...
  900.  
  901. if (CMOpen(hconn, false, nil, 0))
  902. {
  903.     CMDispose(hconn);
  904.     return();
  905. }
  906.  
  907. // read and write to your heart's content using CMRead and CMWrite
  908.  
  909. (void) CMClose(hconn, false, nil, 0, false);
  910.  
  911. CMDispose(hconn);
  912.  
  913. - ---
  914. The advantage to using the CTB is that you can make connections over ADSP,
  915. TCP/IP, Telnet, and so on without changing a line of code...
  916.  
  917. Remember, there are getting to be more people out there with more than two
  918. serial port (or at least devices which act as serial ports)!!!  Don't make
  919. us hack more code to get your program to work on our hardware!  (Hear me,
  920. Apple Print Shop and Remote Access teams!?!)
  921.  
  922.  
  923. ===============================================================================
  924. | Glenn L. Austin                | "Turn too soon, run out of room.           |
  925. | Macintosh Wizard and           |    Turn too late, much better fate."       |
  926. | Auto Racing Driver             |   -- Jim Russell Racing School Instructors |
  927. | Usenet:  glenn@gla-aux.uucp or glenn%gla-aux.uucp@skinner.cs.uoregon.edu    |
  928. ===============================================================================
  929.  
  930. ---------------------------
  931.  
  932. From: umduddr0@ccu.umanitoba.ca (Brendan Duddridge)
  933. Subject: Looping Asynch Sound
  934. Date: 23 Mar 92 19:04:22 GMT
  935. Organization: University of Manitoba, Winnipeg, Canada
  936.  
  937. Hi.  I've been trying to get Asynchronous sounds to work on my Macintosh IIsi
  938. in Think Pascal 4.01.  I have successfully created an animation that plays
  939. while a sound is playing.  No problems there.  What I'd like to know is how
  940. can I get the sound to keep looping and stop only when the user presses the
  941. mouse button?  I keyed in the UAsynchSound unit from the Usenet Macintosh
  942. Programmers Guide.  I think it was written by Leonard Rosenthal at Apple.
  943. Anyway, It crashes whenever the sound stops playing.  The callBack routine
  944. seems to be causing a Bus error and my Mac pops into MacsBug.  What I was
  945. attempting to do was find out when a sound had stopped playing so I could call
  946. SndPlay again to loop it.  Any ideas?  I'm running System 7.01 w/ TuneUp.
  947.  
  948. Thanks... 
  949. - -- 
  950. Brendan Duddridge
  951. InterNet        : umduddr0@ccu.umanitoba.ca
  952. America Online  : BrendanD1
  953.  
  954. +++++++++++++++++++++++++++
  955.  
  956. From: Jochen.Meyer@arbi.informatik.uni-oldenburg.de (Jochen Meyer)
  957. Date: 25 Mar 92 13:43:25 GMT
  958. Organization: University of Oldenburg, Germany
  959.  
  960. umduddr0@ccu.umanitoba.ca (Brendan Duddridge) writes:
  961.  
  962. >mouse button?  I keyed in the UAsynchSound unit from the Usenet Macintosh
  963. >Programmers Guide.  I think it was written by Leonard Rosenthal at Apple.
  964. >Anyway, It crashes whenever the sound stops playing.  The callBack routine
  965. >seems to be causing a Bus error and my Mac pops into MacsBug.  What I was
  966.  
  967. You possibly  didn't switch off the debug and other checking options for
  968. the callback routine. This is absolutely necessary, since the debug code
  969. seems to do things that are not allowed at interrupt time.
  970.  
  971. Using something like
  972.    {$PUSH}
  973.    {$D-}
  974.    (other options)
  975.    (callback procedure)
  976.    {$POP}
  977. should help (at least it did, when I had the same problem).
  978.  
  979. Jochen
  980.  
  981.  
  982. - -- 
  983.  
  984. **************************************************************************
  985. *                      Jochen Meyer                                      *
  986. *          Tel. (Germany) 0441 / 508547 (voice)                          *
  987. *                                                                        *
  988. * inHouse: faustus@faramir                                               *
  989. * email:   Jochen.Meyer@arbi.informatik.uni-oldenburg.de                 *
  990. **************************************************************************
  991.  
  992. ---------------------------
  993.  
  994. From: Joe.Francis@dartmouth.edu (Joe Francis)
  995. Subject: C++ exception handling (was: Zortech C++ Summary)
  996. Date: 24 Mar 92 07:34:30 GMT
  997. Organization: Dartmouth College, Hanover, NH
  998.  
  999. In article <zj-j2vrnagle@netcom.com>
  1000. nagle@netcom.com (John Nagle) writes:
  1001.  
  1002. > With some work, Symantec could leapfrog MPW and bring C++ up to the
  1003. > level documented in Strostrup's latest definition of the language.
  1004. > C++ with exceptions, and classes that use them properly to protect
  1005. > themselves, could provide a much more reliable support structure for
  1006. > Mac programs.  This might provide a path out of the general flakeyness
  1007. > of Mac programs.
  1008.  
  1009. Much to my pleasant surprise, I discovered that it is not that
  1010. difficult to implement your own try/catch-like exception scheme for MPW
  1011. C++.
  1012.  
  1013. Just have every "try" initialize an "exception scope" when at the
  1014. beginning of the block, and clean it up at the end.  Every catch also
  1015. cleans up the "scope", too.
  1016.  
  1017. Derive all of your objects (or all of your non-Handle-based objects, or
  1018. whatever subset of your objects you want this to work for) off of a
  1019. root class.  This root class has code in it's constructor to interact
  1020. with your exception code that, specifically, instantiates a linked list
  1021. element that associates your new object with the current exception
  1022. scope.  The destructor does the reverse, of course.
  1023.  
  1024. When you reach the end of a "try" block (success!) any items left on
  1025. the current scope's list get appended on to the list of the next scope
  1026. up, if any.  Of course, if all the objects that were using this scheme
  1027. were stack based, then there won't be any items in the list when you
  1028. reach the end of the try block - all the stack based objects in that
  1029. block (and any called by it) already automagically had their
  1030. destructors called, and hence removed themselves from the list.
  1031.  
  1032. The case for the "catch" is pretty much the same (remaining objects
  1033. about to outlive their scope are handed off to the parent scope), but
  1034. some important work has occurred before the "catch" is ever reached. 
  1035. When an error occurs, and a "throw" is called, the throw code walks the
  1036. list associated with the current exception scope and destroys all the
  1037. associated objects.  (Note that this must happen before the longjmp
  1038. back to the "catch", otherwise any stackbased objects become invalid
  1039. and cannot safely be destroyed.)
  1040.  
  1041. That's all there is to it, as far as the basics go.  There are some
  1042. things to note:
  1043.  
  1044. * The basic try/throw mechanism is based on setjmp/longjmp,  which are
  1045. described in K&R C and also the MPW C documentation.  
  1046.  
  1047. * I made no attempt to imitate the "typing" of catch statements
  1048. described in C++PL, 2nd edition.  I didn't need this, and I don't think
  1049. it can be cleanly done without the compiler's support & TLC.
  1050.  
  1051. * Yes, this will exact a performance penalty.  If you want to use
  1052. 20,000 stack based objects in a try-scope, you'll eat up space and
  1053. time.  My use of objects is not so extreme as to cause any noticeable
  1054. degradation.
  1055.  
  1056. * I wanted to get let the programmer have some control, on an object by
  1057. object basis, how it interacted with the exception code; and I wanted
  1058. different types of objects to have different types of default behavior.
  1059.  Stack based objects go onto the current scope by default, heap based
  1060. objects do not play the game by default.  This means that the root
  1061. class constructor has to figure out if an object is on the stack.  The
  1062. following macros have worked for me (and *please* let me know if they
  1063. are faulty):
  1064. #define
  1065. ONSTACK(a)(((long)(a)<=*(long*)CurStackBase)&&((long)(a)>*(long*)ApplLim
  1066. it))
  1067. #define INHEAP(a)
  1068. (((long)(a)>=*(long*)ApplZone)&&((long)(a)<*(long*)HeapEnd))
  1069.  
  1070. * The code that deletes all the objects on a scope list during a
  1071. "throw" has to figure out whether it stack or heap based no matter
  1072. what, of course, so that it can properly delete it.  If it's heap based
  1073. you "delete object;", but if it's stack based, you
  1074. "object->RootObject::~RootObject();".  At least that's what you do with
  1075. MPW C++ 3.x.  I've examined the intermediate code and verified that
  1076. these two methods of deletion generate exactly the same code, except
  1077. for a flag argument that tells the destructor whether or not to do a
  1078. "free" on the object's 'this' pointer.  Note that the
  1079. "object->RootObject::~RootObject();" call still exercises virtual
  1080. destructors.  This was not obvious to me at first, especially since the
  1081. same syntax with any member function other than a destructor will not
  1082. result in virtual member functions of child classes being honored. 
  1083. Fortunately the destructor syntax works differently.  (The syntax you
  1084. might think was most natural, "object->~RootObject();", is just plain
  1085. illegal for reasons I don't understand.)  
  1086.  
  1087. * Use different keywords than "try" and "catch" - MPW C++ treats these
  1088. as key words reserved for future use.  I used "ATTEMPT" and "RECOVER".
  1089. (I know, no imagination.  I should have used "SOYBEAN" and "POWERTOOL",
  1090. or maybe "QUAYLE" and "BARBARA".)
  1091.  
  1092. * The best part about all of this is that you then control the
  1093. exception handling functionality. You can't easily add support for,
  1094. say, error alerts (or notifications if you are in the background at the
  1095. time) to the try/throw/catch mechanism that will eventually be supplied
  1096. with MPW C++ version 17.0, but you can throw the whole kitchen sink
  1097. into your own exception code, if you so desire.
  1098.  
  1099. I want to encourage people to try this sort of thing if they are
  1100. hurting (like I was) for a throw mechanism that cleans up orphaned
  1101. objects.  It really didn't turn out to be as big a job as I thought. 
  1102. You write a little code, you change all your favorite base class
  1103. declarations to hang off of RootObject, and your off!
  1104.  
  1105. +++++++++++++++++++++++++++
  1106.  
  1107. From: greggor@Apple.COM (Greg L. Anderson)
  1108. Date: 24 Mar 92 21:21:03 GMT
  1109. Organization: Apple Computer Inc., Cupertino, CA
  1110.  
  1111. In article <1992Mar24.073430.14290@dartvax.dartmouth.edu> Joe.Francis@dartmouth.edu (Joe Francis) writes:
  1112. >The following macros have worked for me (and *please* let me know if they
  1113. >are faulty):
  1114. >#define
  1115. >ONSTACK(a)(((long)(a)<=*(long*)CurStackBase)&&((long)(a)>*(long*)ApplLim
  1116. >it))
  1117. >#define INHEAP(a)
  1118. >(((long)(a)>=*(long*)ApplZone)&&((long)(a)<*(long*)HeapEnd))
  1119.  
  1120. These macros will work for all current & normal Mac environments, and
  1121. they will also work with the Threads package published in Develop #6.
  1122. One might imagine that some future threads package might place stacks
  1123. inside of your heap, in which case it would not be so easy to determine
  1124. if an object is heap based or stack based.
  1125.  
  1126. With luck, though, we'll have language support for try/throw/catch before
  1127. then, and it won't be an issue.
  1128.  
  1129. Good article, by the way.
  1130.  
  1131. - -- 
  1132. =====================   ===========================   =====================
  1133. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  1134. Macintosh Bodhisattva   Macintosh System Software      O O  is  ideal  O O
  1135. greggor@apple.com       Finder Team                     O     shape     O
  1136. =====================   ===========================   =====================
  1137.  
  1138. ---------------------------
  1139.  
  1140. End of C.S.M.P. Digest
  1141. **********************
  1142.